<%@page language="java" isELIgnored="false" contentType="text/html"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix='fn' uri='http://java.sun.com/jsp/jstl/functions'%>
<div style="float: right; margin: 5px 5px 0px 0px; display: none;">
		<form method="post" action="">
			<input type="text" class="uiTextbox" id="txtSearch" size="30" name="query" value="${query }" /> <input
				type="submit" class="uiButton" id="btnSearchSubmit" value="Search" />
		</form>
</div>
<div id="farmButtonStrip" class="buttonStrip">
	<div style="float:left;">
		<a id="btnAdd" class="uiButton" href="farm?action=add">Add</a>
		<a id="btnEdit" class="uiButton" href="farm?action=edit">Edit</a>
		<a id="btnDeleteFarm" class="uiButton" href="farm?action=delete&item=farm&pageNo=${navigationCurrentPage}"">Delete</a>
	</div>
	<div style="float:right;">
		<%@ include file="/WEB-INF/views/navigation.jsp" %>
	</div>
	<div style="clear:both"></div>	
</div>
<div>
	<div style="clear: both"></div>
	<div style="clear: both">
		<div id="farmRecords" style="min-height: 400px;">
			<table class="recordTable" width="100%" cellpadding="0" cellspacing="0">
				<thead>
					<tr>
						<th><input type="checkbox" id="cbxSelectAllItems" /></th>
						<th>Name</th>
						<th>No of Kraals</th>
						<th>Address</th>
						<th>Manager</th>
					</tr>
				</thead>
				
				<tbody>
				<c:choose>
					<c:when test="${not empty farmList  && fn:length(farmList) > 0}">
							<c:forEach var="farm" items="${farmList }">
								<tr id="${farm.id }" class="selectedRow" url="farm?action=view&item=farm&id=${farm.id }">
											<td><input name="selectedFarm" type="checkbox" id="${farm.id }" value="${farm.id }" />
											</td>
											<td>${farm.name }</td>
											<td>${fn:length(farm.kraals)}</td>
											<td>
												Physical Address: ${farm.address.physicalAddress }<br/>
												PhoneNo: ${farm.address.phoneNo } <br/>
												Post Office code: ${farm.address.postOfficeCode }<br/>
												Email : ${farm.address.email }
											</td>
											<td>${farm.manager.firstName}</td>
										</tr>
									</c:forEach>
						</c:when></c:choose>
						</tbody>
			</table>
		</div>
	</div>
</div>